package com.cby.library.tool.ui

import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.view.View
import android.widget.Spinner
import androidx.appcompat.app.AppCompatActivity
import com.cby.library.tool.R
import com.cby.library.tool.crash.ui.CrashActivity
import com.cby.library.tool.log.CbyLogInfoListActivity
import com.cby.library.tool.network.ui.NetRequestActivity

/**
 * @description: CbyToolsActivity
 *
 * @author ChenBaoyang
 * @date 2021/10/20 18:01
 */
class CbyToolsActivity :Activity(){
    
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_jason_tools)

        val modeSp = findViewById<Spinner>(R.id.spinner_mode)
        ModeHelper.getInstance(this@CbyToolsActivity).initModeSpinner(modeSp)
    }

    fun onClickOpenCrash(view: View?) {
        openPage(CrashActivity::class.java)
    }

    fun onClickOpenNet(view: View?) {
        openPage(NetRequestActivity::class.java)
    }

    fun onClickOpenLog(view: View?) {
        openPage(CbyLogInfoListActivity::class.java)
    }

    private fun openPage(clz: Class<*>) {
        val intent = Intent(this@CbyToolsActivity, clz)
        startActivity(intent)
    }

}